<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>添加题目</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <script src="/bootstrap/js/jquery.min.js"></script>
    <script src="/bootstrap/js/bootstrap.min.js"></script>
    <script>
        function addAnswers() {
            $("#answer .col-md-6").append('<span><input type="text" name="contexts"><select name="correctFlag"><option value="0">错</option><option value="1">对</option></select> <button type="button" onclick="addAnswers()">添加</button><br/><br/> </span>');
        }
        $(function () {

            $("#selcttype").change(function () {
                var t=$(this).val();
                if(t=='3'){//判断
                    $("#answer .col-md-6").html('<input type="radio" name="answerId"  value="1">&nbsp;&nbsp;对 <input type="radio" name="answerId"  value="0">&nbsp;&nbsp;错');
                }else{//选择
                    $("#answer .col-md-6").html('<span> <input type="text" name="contexts"><select name="correctFlag"><option value="0">错</option><option value="1">对</option></select> <button type="button" class="addAnswer" onclick="addAnswers()">添加</button><br/><br/> </span>');
                }
            });
        });

    </script>
</head>
<body>

<div class="container">
    <div class="panel panel-success">
        <div class="panel-heading panel-title text-center">
            <h2>添加题目</h2>
        </div>
        <div class="panel-body">
            <form action="/questController/saveQuest" class="form-horizontal" method="post">
                <div class="form-group">
                    <label for="" class="col-md-3 text-right">题目标题:</label>
                    <div class="col-md-6">
                        <input type="text" name="title" class="form-control" placeholder="请输入题目标题" maxlength="100">
                    </div>
                </div>
                <input type="hidden" name="rid" value="${rid}"/>
                <div class="form-group">
                    <label for="" class="col-md-3 text-right">题目类型:</label>
                    <div class="col-md-6">
                        <select id="selcttype" name="type">
                            <option value="">=选择=</option>
                            <option value="1">单选</option>
                            <option value="2">多选</option>
                            <option value="3">判断</option>
                        </select>
                    </div>
                </div>
                <div class="form-group" id="answer">
                    <label for="" class="col-md-3 text-right">答案:</label>
                    <div class="col-md-6">


                    </div>
                </div>
                <div class="form-group" style="margin-left: 200px;">
                    <button type="submit" class="btn btn-success col-lg-offset-3">保存</button>
                </div>
            </form>
        </div>

    </div>
</div>

</body>
</html>